package com.luban.ziya.sync;

/**
 * Created By ziya
 * QQ: 3039277701
 * 2021/10/25
 */
public class SyncDebug {
    public static void main(String args[]) throws InterruptedException{
        SyncDebug c = new SyncDebug();

        new Thread(){
            public void run() {
                try {
                    c.add();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }.start();

        int sum = c.add();


        System.out.println("dddddddddddddddddddd");
// System.gc();
    }

    public int add() throws InterruptedException{
        synchronized(this){
            int b = 1;
            int c = 2 + b;
            Thread.sleep(100000000000l);
        }

        return 0;
    }
}
